/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 26727
 * Date: 2025-10-07
 * Time: 23:03
 */
public class TestH3 {
    public static int removeDuplicates(int[] num) {
        int slow = 0, fast = 1, n = num.length;
        while(fast < n) {
            if(num[fast] != num[slow]) {
                num[slow+1] = num[fast];
                slow++;
            }
            fast++;
        }
        return slow+1;
    }
    public static void main(String[] args) {
        int[] num = {0,0,1,1,1,2,2,2,2,3,3,3,3,4,4,4};
        int ret = removeDuplicates(num);
        System.out.println(ret);
    }
}
